﻿using Leo.Awesome.AppPlatform.Dtos;
using Microsoft.AspNetCore.Authorization;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Swashbuckle.AspNetCore.Annotations;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;
using static Leo.Awesome.AppPlatform.AppPlatfromApplcationContractsConsts;
using Leo.Awesome.AppPlatform.Services;
using Volo.Abp.Identity;
using System;

namespace Leo.Awesome.AppPlatform.Controllers
{
    [Area(ModuleName)]
    [RemoteService(Name = RemoteServiceName)]
    [Route("api/identity/[controller]")]
    [SwaggerTag("角色管理")]
    public class RolesController : AbpControllerBase
    {
        private readonly IRolesService rolesService;

        public RolesController(IRolesService rolesService)
        {
            this.rolesService = rolesService;
        }
        [HttpGet("getUsersById/{id}")]
        [SwaggerOperation(
             Summary = "根据角色id获取用户列表",
             Description = "",
             OperationId = "",
             Tags = new[] { "Roles" }
           )]
        [Authorize(IdentityPermissions.Roles.ManagePermissions)]
        public async Task<List<IdentityUserDto>> GetUsersById(Guid id)
        {
            return await rolesService.GetUserById(id);
        }
    }
}
